package com.qf.shopping.servlet.backController;

import com.qf.shopping.common.Constants;
import com.qf.shopping.common.DisatpcherServlet;
import com.qf.shopping.dto.BackOrder;
import com.qf.shopping.service.IBackOrderService;
import com.qf.shopping.service.IOrderService;
import com.qf.shopping.service.impl.BackOrderServiceImpl;
import com.qf.shopping.service.impl.OrderServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**后台订单管理模块
 * @author 三旬
 * @version 1.0  2022/9/24
 */
@WebServlet("/BackOrderController/*")
public class BackOrderController extends DisatpcherServlet {
    //创建访问业务层的接口
    IBackOrderService orderService = new BackOrderServiceImpl();

    /**
     * 获得商品订单列表
     * @param request
     * @param response
     * @return
     */
    public String getOrderList(HttpServletRequest request, HttpServletResponse response){
        //发送请求拿到后台的订单信息
        List<BackOrder> backOrderList = orderService.getOrderList();

        if(backOrderList != null){
            request.setAttribute("orderList",backOrderList);
            return Constants.FORWARD+":"+"back/order/orderlist.jsp";
        }
        return Constants.SCRIPT+":"+"暂无订单消息！";
    }

}
